package server.main.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import server.main.mapper.PermissionMapper;
import server.main.pojo.Account;
import server.main.service.PermissonService;
import server.main.pojo.Permission;

import java.util.List;

/**
 * @auther MingHsZzz
 * @Date 2022/9/18  13:43
 * @project main
 * @description
 */


@Service("PermissonService")
public class PermissonServiceImpl extends ServiceImpl<PermissionMapper,Permission> implements PermissonService {
    @Autowired
    PermissionMapper permissionMapper;




    @Override
    public List<Permission> getAllpermissions(){



        return permissionMapper.getAllpermissions();
    }

    @Override
    public Page<Permission> getAllpermissionByPage(String permissionname, Integer pageNum, Integer pageSize) {



        Page<Permission> page = page(new Page<>(pageNum, pageSize));


        for (Permission record : page.getRecords()) {
            record.setFunctionPages(permissionMapper.getUrlsByPermissionId(record.getId()));
        }

        return page;

    }


}
